package com.freeter.common.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 汉字处理
 */
public class ChineseUtil {

    public static String  getChineseEnglisNumberText(String sourceString) {
        // 使用正则表达式匹配汉字
        Pattern pattern = Pattern.compile("[-a-zA-Z0-9\u4e00-\u9fa5]+");
        Matcher matcher = pattern.matcher(sourceString);
        StringBuffer sb = new StringBuffer();
        // 迭代匹配结果
        while (matcher.find()) {
            String chineseCharacter = matcher.group();
            // 输出每个汉字
            sb.append(chineseCharacter);
        }
        return sb.toString();
    }

}
